// Copyright (c) 2011 Solar Technology
// All rights reserved.
// 
// We use Table-Driven Methods to deal with Parameters, ranges and device types.
// And this file provides routines for that.

#ifndef _PROGRAM_TABLEDRIVER_H
#define _PROGRAM_TABLEDRIVER_H

#include <vector>
#include <string>
#include "define.h"

namespace TableDriver {

const prm_tbl_s *Param(ushort prm_code);
ushort ParamCode(const std::string& prm_name, para_attr_e prm_attr);
std::string ParamName(ushort prm_code);

// find all parameters with the same attr
std::vector<std::string> ParamList(para_attr_e attr);

// find all paramters with the specific attr, bmode and mmode.
// when bmode or mmode is '0', bmode/mmode will be ignored when searching.
std::vector<std::string> RangeList(para_attr_e attr, char bmode, char mmode);

// return item's bias/meas range list
std::vector<std::string> ItemRangeList(int item_code, para_attr_e attr);

const rng_tbl_s *Range(ushort code);

// return device's index in the device array
int DeviceIndex(ushort code);

const devtbl_s *DeviceTable();



// MASTER ITEM CHECK

bool IsMasterItem(ushort item_code);
bool IsHueItem(ushort item_code);
bool IsVlItem(ushort item_code);
bool IsDlmItem(ushort item_code);

} // namespace TableDriver


#endif // _PROGRAM_TABLEDRIVER_H
